home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / ANSI Headers / ctype.h < prev    next >
Text File  |  1995-08-17  |  3KB  |  95 lines

  1. /* ctype.h standard header */
  2. #ifndef _CTYPE
  3. #define _CTYPE
  4. #include <yvals.h>
  5.  
  6. #if __MWERKS__
  7. #pragma options align=mac68k
  8. #pragma direct_destruction off
  9. #endif
  10.  
  11. #ifndef _STDIO
  12. #define EOF        (-1)
  13. #endif
  14.  
  15.         /* _Ctype code bits */
  16. #define _XA        0x00 /* extra alphabetic (unused) */
  17. #define _XS        0x00 /* extra space (unused) */
  18. #define _BB        0x80 /* BEL, BS, etc. */
  19. #define _CN        0x40 /* CR, FF, HT, NL, VT */
  20. #define _DI        0x20 /* '0'-'9' */
  21. #define _LO        0x10 /* 'a'-'z' */
  22. #define _PU        0x08 /* punctuation */
  23. #define _SP        0x04 /* space */
  24. #define _UP        0x02 /* 'A'-'Z' */
  25. #define _XD        0x01 /* '0'-'9', 'A'-'F', 'a'-'f' */
  26.         /* declarations */
  27. extern const char *_Ctype, *_Tolower, *_Toupper;
  28. #ifdef __cplusplus
  29.         /* inlines, for C++ */
  30. inline int isalnum(int _C)
  31.     {return (_Ctype[_C] & (_DI|_LO|_UP|_XA)); }
  32. inline int isalpha(int _C)
  33.     {return (_Ctype[_C] & (_LO|_UP|_XA)); }
  34. inline int iscntrl(int _C)
  35.     {return (_Ctype[_C] & (_BB|_CN)); }
  36. inline int isdigit(int _C)
  37.     {return (_Ctype[_C] & _DI); }
  38. inline int isgraph(int _C)
  39.     {return (_Ctype[_C] & (_DI|_LO|_PU|_UP|_XA)); }
  40. inline int islower(int _C)
  41.     {return (_Ctype[_C] & _LO); }
  42. inline int isprint(int _C)
  43.     {return (_Ctype[_C] & (_DI|_LO|_PU|_SP|_UP|_XA)); }
  44. inline int ispunct(int _C)
  45.     {return (_Ctype[_C] & _PU); }
  46. inline int isspace(int _C)
  47.     {return (_Ctype[_C] & (_CN|_SP|_XS)); }
  48. inline int isupper(int _C)
  49.     {return (_Ctype[_C] & _UP); }
  50. inline int isxdigit(int _C)
  51.     {return (_Ctype[_C] & _XD); }
  52. inline int tolower(int _C)
  53.     {return (_Tolower[_C]); }
  54. inline int toupper(int _C)
  55.     {return (_Toupper[_C]); }
  56. #else
  57.         /* declarations and macro overrides, for C */
  58. _C_LIB_DECL
  59. int isalnum(int), isalpha(int), iscntrl(int), isdigit(int);
  60. int isgraph(int), islower(int), isprint(int), ispunct(int);
  61. int isspace(int), isupper(int), isxdigit(int);
  62. int tolower(int), toupper(int);
  63. _END_C_LIB_DECL
  64. #define isalnum(c)    (_Ctype[(c)] & (_DI|_LO|_UP|_XA))
  65. #define isalpha(c)    (_Ctype[(c)] & (_LO|_UP|_XA))
  66. #define iscntrl(c)    (_Ctype[(c)] & (_BB|_CN))
  67. #define isdigit(c)    (_Ctype[(c)] & _DI)
  68. #define isgraph(c)    (_Ctype[(c)] & (_DI|_LO|_PU|_UP|_XA))
  69. #define islower(c)    (_Ctype[(c)] & _LO)
  70. #define isprint(c)    (_Ctype[(c)] & (_DI|_LO|_PU|_SP|_UP|_XA))
  71. #define ispunct(c)    (_Ctype[(c)] & _PU)
  72. #define isspace(c)    (_Ctype[(c)] & (_CN|_SP|_XS))
  73. #define isupper(c)    (_Ctype[(c)] & _UP)
  74. #define isxdigit(c)    (_Ctype[(c)] & _XD)
  75. #define tolower(c)    (_Tolower[(c)])
  76. #define toupper(c)    (_Toupper[(c)])
  77. #endif /* __cplusplus */
  78.  
  79. #if __MWERKS__
  80. #pragma options align=reset
  81. #pragma direct_destruction reset
  82. #endif
  83.  
  84. #endif /* _CTYPE */
  85.  
  86. /*
  87.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  88.  * Consult your license regarding permissions and restrictions.
  89.  */
  90.  
  91. /* Change log:
  92.  *94June04 PlumHall baseline
  93.  *94Oct07 Inserted MW changes.
  94.  */
  95.